From: Daniel Boles Date: Mon, 12 Mar 2018 22:44:37 +0000 (+0000) Subject: FileChooserWidget: Avoid crash freeing static str X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~37^2~2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9d8fadee976d589645663eade2b83258ed0a005e;p=gtk%2B3.0.git FileChooserWidget: Avoid crash freeing static str Having a FileChooserDialog in location-entry mode then pressing f to move to search mode would crash with an invalid free(). In that case, FileChooserWidget.get_subtitle() returned a static string straight from gettext. This crashed when the GBinding from :subtitle to FileChooserDialog’s HeaderBar:subtitle shortly tried to free the string. Fix by duplicating the string before returning it, like all other paths. https://bugzilla.gnome.org/show_bug.cgi?id=791004 --- diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 5e9557ae75..e7e2d96234 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -3271,7 +3271,7 @@ gtk_file_chooser_widget_get_subtitle (GtkFileChooserWidget *impl) { gchar *location; - subtitle = _("Searching"); + subtitle = g_strdup (_("Searching")); location = gtk_places_sidebar_get_location_title (GTK_PLACES_SIDEBAR (priv->places_sidebar)); if (location)